<?php

use App\Http\Controllers\Auth\AuthController;
use App\Http\Controllers\Auth\DashboardController;
use Illuminate\Support\Facades\Route;

// 前台api
Route::prefix('auth')->name('auth.')->group(function() {
    // 注册、登陆、退出
    Route::controller(AuthController::class)->group(function() {
        Route::post('login', 'postLogin')->name('login.post');
        Route::post('registration', 'postRegistration')->name('register.post');
        Route::get('logout', 'logout')->middleware(['auth:api', 'set.team.id:api'])->name('logout');
    });

    // 会员中心
    Route::middleware(['auth:user', 'set.team.id:user'])->group(function() {

        Route::get('dashboard', [DashboardController::class, 'dashboard'])->name('dashboard');

        // Route::controller(PasswordController::class)->prefix('password')->group(function() {
        //     Route::get('change', 'changePassword')->name('password.change');
        //     Route::post('update', 'update')->name('password.update');
        // });

        // Route::controller(GroupController::class)->group(function() {
        //     Route::get('group',  'index')->name('group');
        //     Route::get('buy/group',  'buy')->name('buy.group');
        // });

        // Route::get('profile', [ProfileController::class, 'index'])->name('profile');

    });
});

// 后台api
Route::prefix('admin')->name('admin.')->group(function() {
    // 注册、登陆、退出
    Route::controller(AuthController::class)->group(function() {
        Route::post('login', 'postLogin')->name('login.post');
        Route::get('logout', 'logout')->middleware(['auth:admin', 'set.team.id:admin'])->name('logout');
    });
});
